package com.aiit.pojo.order;

import com.aiit.util.ChangeDate;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFilter;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.ParseException;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("t_purchase_order")
public class PurchaseOrder {
    @ApiModelProperty(value = "主键id")
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "零件ID")
    private Integer lingjianId;
    @ApiModelProperty(value = "零件名")
    private String lingjianName;
    @ApiModelProperty(value = "订单零件数量")
    private Integer number;
    @ApiModelProperty(value = "交付零件数量")
    private Integer trueNumber;
    @ApiModelProperty(value = "订单总金额")
    private Double totalAmount;
    @ApiModelProperty(value = "交付总金额")
    private Double trueTotalAmount;
    @ApiModelProperty(value = "员工ID")
    private Integer userId;
    @ApiModelProperty(value = "员工名")
    private String userName;
    @ApiModelProperty(value = "商家ID")
    private Integer merchantId;
    @ApiModelProperty(value = "商家名")
    private String merchantName;
    @ApiModelProperty(value = "报损/报溢")
    private Integer brimDamage;
    @ApiModelProperty(value = "订单状态(1下单2交付3退单)")
    private Integer state;
    @ApiModelProperty(value = "退单原因")
    private String msg;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @ApiModelProperty(value = "交付日期")
    private Date submissionTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @ApiModelProperty(value = "退单日期")
    private Date outTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @ApiModelProperty(value = "报损/报溢日期")
    private Date bdTime;
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @ApiModelProperty(value = "交付截止日期")
    private Date deadline;
    //逻辑删除
    @ApiModelProperty(value = "逻辑删除")
    @TableField(value = "deleted")
    @TableLogic
    private Integer deleted;

    public void setDeadline(String deadline) throws ParseException {
        this.deadline = new ChangeDate().stringToDate(deadline);
    }
    public void setBdTime(String bdTime) throws ParseException {
        this.bdTime = new ChangeDate().stringToDate(bdTime);
    }

}
